﻿<%@ Import Namespace="WinnerCMS.Model" %>
<%@ Register Assembly="WinnerCMS.WebControls" Namespace="WinnerCMS.WebControls" TagPrefix="TW" %>
<%@ Page Language="C#" AutoEventWireup="true" Inherits="WinnerCMS.WebFactory.PublicPage" %>

 
<!doctype html>
<html>
<head runat="server">
    <title>Tags 列表</title>
    <%: Styles.Render("~/WinnerCMS6/Style") %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Bind();
        }

        private void Bind()
        {
            PagingParam pp = new PagingParam
            {
                PageNo = Convert.ToInt32(Request["PageNo"]), 
                PageSize = this.PageNavigation1.PageSize
            };

            var list = new TagsManage().BindList(int.Parse(Request["ID"]), pp);

            this.Repeater1.DataSource = list;
            this.Repeater1.DataBind();

            this.PageNavigation1.RecordCount = pp.RecordCount;
            this.PageNavigation2.RecordCount = pp.RecordCount;
        }

        protected void PageNavigation1_PageChanged(object sender, EventArgs e)
        {
            //Bind();

        }
        int _rowIndex = 0;
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Literal lIndex = e.Item.FindControl("L_Index") as Literal;
                lIndex.Text = string.Format("{0}", ((this._rowIndex++) + 1) + (this.PageNavigation1.PageNo - 1) * this.PageNavigation1.PageSize);
            }
        }
    </script>
</head>
<body><!--#include file="../Header.aspx"-->
    <form id="form1" runat="server">
    <div class="mainDiv"><TW:PageNavigation ID="PageNavigation2" runat="server" OnPageChanged="PageNavigation1_PageChanged"
            UrlPaging="True" PageSize="30" CssClass="PageNavigation" CustomInfoSectionWidth="200px">
        </TW:PageNavigation>
        <ul>
            <asp:Repeater ID="Repeater1" runat="server" EnableViewState="False" 
                onitemdatabound="Repeater1_ItemDataBound">
            
                <ItemTemplate>
                    <li style="margin: 6px"><asp:Literal ID="L_Index" runat="server"></asp:Literal><a href="<%# Eval("Link") %>" target="_blank">
                        <%# Eval("ContentTitle") %></a> </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
        <TW:PageNavigation ID="PageNavigation1" runat="server" OnPageChanged="PageNavigation1_PageChanged"
            UrlPaging="True" PageSize="30" CustomInfoSectionWidth="200px">
        </TW:PageNavigation>
        
    </div>
     
    <!--#include file="../Footer.aspx"-->
    
    </form>
</body>
</html>
